<?php if ($act == 'edit' OR $act == 'add_new'): ?>
<form class="form-horizontal" id="edit_web_mail_form" method="post">
	<input type="hidden" name="page" value="mau_web" />
	<input type="hidden" name="web_mail[web_mail_id]" value="<?= $edited_wm['web_mail_id'] ?>" />
	<fieldset>
		<legend style="margin-bottom: 10px">
			<?php if ($act == 'add_new'): ?>
				Thêm mẫu web
			<?php else: ?>
				Sửa mẫu web #<?= $edited_wm['web_mail_id'] ?>			
			<?php endif; ?>
		</legend>
		<br />
		<div style="width: 440px;float: left; margin-top: 10px;">
			<div class="control-group">
				<label class="control-label" for="name">Tiêu đề</label>
				<div class="controls">
					<input type="text" name="web_mail[name]" value="<?= $edited_wm['name'] ?>" class="input-xlarge" id="name" />
					<p class="help-block">
					</p>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="path">Đường dẫn</label>
				<div class="controls">
					<input type="text" name="web_mail[path]"  value="<?= $edited_wm['path'] ?>" class="input-xlarge" id="path">
					<p class="help-block">
					</p>
				</div>
			</div>
		</div>
		<div class="control-group" style="margin-top: 10px">
			<label class="control-label" for="description">Mô tả</label>
			<div class="controls">
				<textarea  name="web_mail[description]" class="input-xlarge" id="description" rows="4"><?= $edited_wm['description'] ?></textarea>
				<p class="help-block">
				</p>
			</div>
		</div>
		<div class="form-actions" style="border-bottom: 1px solid #DDD; margin-top: -32px; border-top: none;">
			<button type="submit" name="act" value="<?= ($act == 'add_new')? 'add' : 'update' ?>" class="btn btn-primary">Lưu lại</button>
			<a href="<?= URL ?>?page=mau_web" class="btn">Hủy bỏ</a>
		</div>
	</fieldset>
</form>
<?php endif; ?>

<h2 class="popover-title">Mẫu web</h2>
<div id="notification">
  <?php if (isset($success)) : ?>
    <?php if ($success == true) : ?>
      <div class="alert alert-success"><?= $msg ?></div>
    <?php else : ?>
      <div class="alert alert-error"><?= $msg ?></div>
    <?php endif; ?>
  <?php endif; ?>
</div>
<div id="action">
  <a class="btn btn-success" href="<?= URL ?>?page=mau_web&act=add_new"><i class="icon-plus"></i> Thêm mới</a>
</div>
<ul class="thumbnails" id="web_mail_list">
	<?php foreach ($web_mails as $web_mail) : ?>
	<li class="span3">
	<div class="thumbnail">
		<div class="thumbnail_wrapper">
		<a href="<?= $web_mail_url . $web_mail['path'] ?>/index.html" target="_blank">
			<img src="<?= $web_mail_url . $web_mail['path'] ?>/screenshot.png" alt="<?= $web_mail['path'] ?>" width="180" height="260" />
		</a>
		</div>
		<div class="caption">
			<h5><?= $web_mail['name'] ?></h5>
			<p class="description"><?= $web_mail['description'] ?></p>
			<p>
				<a href="<?= URL ?>?page=mau_web&act=edit&web_mail_id=<?= $web_mail['web_mail_id'] ?>" class="btn btn-mini"><i class=" icon-edit"></i> Sửa</a>
				<a href="<?= URL ?>?page=mau_web&act=delete&web_mail_id=<?= $web_mail['web_mail_id'] ?>" class="btn btn-mini btn_delete"><i class="icon-trash"></i> Xóa</a>
			</p>
		</div>
	</div>
	</li>
	<?php endforeach; ?>
</ul>